#define  _CRT_SECURE_NO_WARNINGS 1		
#include <stdio.h>
int main()
{
	int n = 0;
	scanf("%d", &n);
	int count = 1;
	int row = 0, col = 0;
	int arr[50][50] = { 0 };
	int i = 0;
	while (count <= n * n)
	{
		for (i = 0; i < 2; i++)
		{
			if (row < n && col < n)
			{
				arr[row][col] = count++;
			}
			col++;
		}
		col--;
		while (col)
		{
			row++;
			col--;
			if (row < n && col < n)
			{
				arr[row][col] = count++;
			}
		}
		row++;
		while (row)
		{
			if (row < n && col < n)
			{
				arr[row][col] = count++;
			}
			row--;
			col++;
		}
	}
	for (row = 0; row < n; row++)
	{
		for (col = 0; col < n; col++)
		{
			printf("%d ", arr[row][col]);
		}
		printf("\n");
	}
	return 0;
}
